
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page session="true" import="model.Cliente" errorPage="PaginaError.jsp"%>
<%@page import="java.util.*"%>
<jsp:useBean id="model"	scope="session" class="model.WebModel"/>
<jsp:useBean id="cli"	scope="page" class="model.Cliente"/>
<%
     
            HttpSession sesion = request.getSession();

            String consulta = (String) sesion.getAttribute("consulta");

            request = (HttpServletRequest) pageContext.getRequest();
            String BASEURL = request.getContextPath();
            String CONTROLLER = BASEURL + "/controller";
         
            session.setAttribute("ConsultaCliente", "1");




%>

<%Object id = sesion.getAttribute("ident");

           
            if (id == null) {

                response.sendRedirect("ClienteInicio.jsp");

            } else {%>


<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Confiteria Fuentes-Consulta Cliente</title>
        <script type='text/javascript' src='<%=BASEURL%>/SCRIPS/script.js'></script>

        <link rel='stylesheet' href='<%=BASEURL%>/CSS/style.css' type='text/css' media='screen' />

        <link rel="stylesheet" type="text/css" href="<%=BASEURL%>/CSS/view.css" media="all"/>

        <script type="text/javascript" src="<%=BASEURL%>/SCRIPS/view.js"></script>



   


        <style type="text/css">
            #form_1511 { width: 500px; }
            #form_1511 label { width: 200px; }
   
        </style>

    </head>
    <body>
        <div id="art-page-background-gradient"></div>
        <div id="art-page-background-glare">
            <div id="art-page-background-glare-image"></div>
        </div>
        <div id="art-main">
            <div class="art-Sheet">
                <div class="art-Sheet-tl"></div>
                <div class="art-Sheet-tr"></div>
                <div class="art-Sheet-bl"></div>
                <div class="art-Sheet-br"></div>
                <div class="art-Sheet-tc"></div>
                <div class="art-Sheet-bc"></div>
                <div class="art-Sheet-cl"></div>
                <div class="art-Sheet-cr"></div>
                <div class="art-Sheet-cc"></div>
                <div class="art-Sheet-body">
                    <div class="art-Header">
                        <div class="art-Header-png"></div>
                        <div class="art-Header-jpeg"></div>
                        <div class="art-Logo">
                            <h1 id="name-text" class="art-Logo-name"><a href="#">Confiteria Fuentes</a></h1>
                            <div id="slogan-text" class="art-Logo-text"></div>
                        </div>
                    </div>
                  
                        <jsp:include page="AdminMenu.jsp" />
               

                    <div class="art-contentLayout">
                        <div class="art-content">
                            <div class="art-Post">
                                <div class="art-Post-body">
                                    <div class="art-Post-inner">

                                        <br>


                                        <div id="main_body" >


                                            <div id="form_container">


                                                <form id="form_1511" class="appnitro"  method="post" action="<%=CONTROLLER%>/Consulta/Cliente">
                                                    <div  class="form_description">
                                                        <h2 id="h11">Consultar Cliente</h2>
                                                        <p></p>
                                                    </div>
                                                       
                                                    <ul >


                                                        <li id="li_1" >


                                                            <table>
                                                                <tr>
                                                                    <td>
                                                                        <label class="description" for="element_1">Digite Segun Opcion</label>
                                                                        <input     name="campo" class=""   type="text" maxlength="15" value=""/>
                                                                    </td>
                                                                       <td>
                                                                        <label class="description" for="element_1">Tipo</label>
                                                                        <select    name="tipo"    type="text" >

                                                                            <option value="1">Idendificacion  </option>
                                                                             <option value="2">Nombre  </option>
                                                                              <option value="3">Apellido  </option>
                                                                              <option value="5">Direccion  </option>
                                                                        </select>
                                                                    </td>

                                                                    <td  valign="bottom">
                                                                        <button   type="submit"  class="left"  ><img src="<%=BASEURL%>/imagenes/buscar1.png"/>Consultar</button>

                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </li>

                                                    </ul>

                                                </form>
                                                     <br/><br/>
                                                <table border="1">
                                                    <tr id="fila">
                                                        <td>
                                                            codigo
                                                        </td>
                                                        <td>
                                                            nombre
                                                        </td>
                                                        <td>
                                                            Segundo Nombre
                                                        </td>
                                                        <td>
                                                            Apellido
                                                        </td>
                                                        <td>
                                                            Segundo Apellido
                                                        </td>
                                                       <td>
                                                            Telefono
                                                        </td>
                                                        <td>
                                                            Direccion
                                                        
                                                        <td>
                                                            E-mail
                                                        </td>
                                                    <tr>
                                                        
                                                 <%
                                                 List clientes =(List) sesion.getAttribute("clientes");
                                                 if(!clientes.isEmpty()){
                                                     
                                                Iterator ite =clientes.iterator();
                                                while(ite.hasNext()){
                                                   Cliente cl= (Cliente)ite.next();

                                              
                                                   %>

                                                         <tr>
                                                        <td>
                                                           <%=cl.getCodigo()%>
                                                        </td>
                                                        <td>
                                                           <%=cl.getNombre()%>
                                                        </td>
                                                       <td>
                                                           <%=cl.getNombre2()%>
                                                        </td>
                                                        <td>
                                                           <%=cl.getApellido()%>
                                                        </td>

                                                        <td>
                                                            <%=cl.getApellido2()%>
                                                        </td>
                                                        <td>
                                                           <%=cl.getTelefono()%>
                                                        </td>
                                                        <td>
                                                        <%=cl.getDireccion()%>
                                                        </td>
                                                        <td>
                                                         <%=cl.getEmail()%>

                                                        </td>
                                                    <tr>


                                                        <% } %>
                                                   <% }%>

                                                </table>





                                                <div class="cleared"></div>


                                                <div class="cleared"></div>
                                            </div>
                                        </div>

                                    </div>
                                                  
                                     <script type="text/javascript" language="javascript">



                                        <%

                                                    String id1 = (String) sesion.getAttribute("ident");
                                                    if (consulta.equals("false") && id1 != null) {
                                        %>


                                            alert("Cliente no se encuentra registrado");

                                        <%sesion.setAttribute("consulta", "nn");
                                                    }%>


                                    </script>




                                    <div class="art-Post">
                                        <div class="art-Post-body">


                                            <div class="cleared"></div>
                                        </div>
                                    </div>
                                </div>

                            </div>
                            <div class="cleared"></div>

                            <div class="cleared"></div>
                        </div>
                    </div>
                    <div class="cleared"></div>

                </div>
            </div>
        </div>

    </body>
</html>
<%}%>